home *** CD-ROM | disk | FTP | other *** search
- /* fd.c - FD program - main function */
- #include "stdio.h"
- #include "cminor.h"
- #include "viewcmds.h"
- #include "fdparm.h"
-
- char filename[65] = "" ;
-
- main(argc,argv)
- int argc ;
- char *argv[] ;
- {
- int cmd ; /* holds current command */
-
- if( argc >= 2 ) /* get file name from command */
- strcpy(filename,argv[1] ) ; /* line ( if present ) */
-
-
- get_filename(filename) ; /* get filename and open file */
- set_filesize(BIN_MODE) ; /* set up filesize variable */
- cmd = FIRSTPAGE ; /* force display to first page */
-
-
- while( cmd != EXITPGM ) /* repeat until told to exit */
- { exec_cmd( cmd ) ; /* execute the current command */
- cmd = get_cmd() ; /* get the next command */
- }
-
- close_file() ;
- }
-
- int get_filename(fn) /* get name of file and open it */
- char fn[] ; /* file name string */
- { /* filled out by caller */
- if ( strlen(fn) == 0 )
- { printf("file name:") ;
- scanf("%s",fn) ;
- }
-
- while( open_file(fn) == FAILURE ) /* open the file (verify name) */
- { printf("\n file - %s can not be opened \n") ;
- printf("file name:") ; /* try again */
- scanf("%s",fn) ;
- }
- }
-
-
-
-